package com.batchaps.gameentity;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class MenuFuntionItem extends Game2DEntity {

	private Image _textureIcon;

	private int _itexture;

	private int _posX;

	private int _posY;

	private int _sizeX;
	private int _sizeY;

	private String _text;

	private int _positionTextX;
	private int _positionTextY;

	private boolean isDraw;

	// private SpriteFont _font;

	public boolean FlagUpdate;

	public MenuFuntionItem(String textureicons, int posX, int posY, int sizeX,
			int sizeY, String text, int postextX, int postextY, boolean isdraw) {
		try {
			_textureIcon = Image.createImage(textureicons);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		_itexture = 0;
		_posX = posX;
		_posY = posY;
		_sizeX = sizeX;
		_sizeY = sizeY;

		_text = text;
		_positionTextX = postextX;
		_positionTextY = postextY;

		isDraw = isdraw;

		// _font = content.Load<SpriteFont>("SpriteFont1");

		FlagUpdate = true;
	}

	public boolean IsClick(int posX, int posY) {
		if (isDraw) {
			if ((posX >= _posX && posX <= _posX + _sizeX)
					&& (posY >= _posY && posY <= _posY + _sizeY)) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	public void Update() {
		/*
		 * if (FlagUpdate) _itexture = (_itexture + 1) % _textureIcon.Count;
		 */
	}

	public void Draw(Graphics g, float gametime) {
		if (isDraw) {
			g.drawImage(_textureIcon, _posX, _posY, 0);

			// spriteBatch.DrawString(_font, _text, _positionText, Color.White);
		}
		// base.Draw(spriteBatch);
	}

}
